<?php 
	$message = $this->message;
?>

<section class="grid_12" style="width: 60%;margin-left: 20%;">
	<div class="block-border" style="margin-bottom: 20px;">
	       <form class="block-content form" id="edit_form" method="post" action="">
				<?php echo $this->formHidden("edit_id", $this->edit_id)?>
				<h1>実績と課徴金</h1>
				
				<fieldset>
					<legend>会議室情報</legend>

					<!-- Message display -->
					<?php if($message):?>
					<ul class="message error no-margin">
						<li><?php echo $message?></li>
					</ul>
					<?php endif;?>

					<p class="inline-label">
						<label for="month">年月</label>
						<?php 
							$month = $this->month;
							$month .= "月";
							$month = str_replace("-", "年", $month);
						?>
						<span><?php echo $month?></span>
					</p>
					
					<p class="inline-label">
						<label for="user">ユーザ</label>
						<span><?php echo $this->username . " (" . $this->name . ")"?></span>
					</p>
					
					<p class="inline-label">
						<label for="order_count">予約数</label>
						<span><?php echo $this->order_count?>　回</span>
					</p>
					
					<p class="inline-label">
						<label for="total_money">実績</label>
						<?php echo $this->formText("total_money", $this->total_money, array("class"=>'with-tip', 'title'=>'VND'))?>
					</p>
					
					<p class="inline-label">
						<label for="total_fee">実績</label>
						<?php echo $this->formText("total_fee", $this->total_fee, array("class"=>'with-tip', 'title'=>'VND'))?>
					</p>
				</fieldset>

				<fieldset class="grey-bg no-margin">
					<p>
						<button type="submit">更新</button>
						<button type="button" id="cancel-btn">キャンセル</button>
					</p>
				</fieldset>
				
			</form>
		</div>
</section>

<!-- Table script -->
<script type="text/javascript">
	$(document).ready(function(){
		$("#cancel-btn").click(function(){
			window.location = "/admin/payment-history/index";
		});
		
		$("#edit_form").validate({
	 		rules: {
				total_money: {
	 				required: true,
	 				number: true,
	 				min: 0
	 			},
	 			
	 			total_fee: {
					required: true,
					number: true,
					min: 0
				}
			},

			messages: {
				total_money: {
					required: "このフィールドは必須です。",
					number: "有効な番号を入力してください。",
					min: "0VNDから入力してください。"
				},

				total_fee: {
					required: "このフィールドは必須です。",
					number: "有効な番号を入力してください。",
					min: "0VNDから入力してください。"
				}
			}
		});
	});	
</script>
